<?php
class Admin_AnnouncementController extends Zend_Controller_Action
{
    protected $_announcement;
    protected $_user;
    protected $_department;

    public function init() {
        $this->_helper->layout()->setLayout('admin');
        $this->_announcement = new Admin_Model_Announcement();
        $this->_user         = Zend_Auth::getInstance()->getIdentity();
        $this->_department   = new Admin_Model_Department();
    }

    public function indexAction() {
        $announcements = $this->_announcement->getAllAnnouncementsAvailableForRole(
            $this->_user->roleId
        );
        
        $this->view->announcements = $announcements;
    }

    public function addAnnouncementAction() {
        $this->view->departments = $this->_department->getAvailableForRoleDepartments(
            $this->_user->roleId
        );

        if ($this->getRequest()->isPost()) {
            $post = $this->getRequest()->getPost();
            var_dump($post);
            exit();
        }
    }   

    public function editAnnouncementAction() {

    }

    public function deleteAnnouncementAction() {
        
    }
}